﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QL_NOI_TRU
{
    public partial class frmNhapDanhSachKhoa : DevExpress.XtraEditors.XtraForm
    {
        public frmNhapDanhSachKhoa()
        {
            InitializeComponent();
        }

        private void frmNhapDanhSachKhoa_Load(object sender, EventArgs e)
        {
            //đỗ dữ liệu vào grid
            var kn = new Ketnoi(frmDangnhap.stringConn);
            gridControl1.DataSource = kn.ExcuteQuery("Select MA_KHOA,TEN_KHOA from KHOA");

        }

        private void btLuu_Click(object sender, EventArgs e)
        {
            //gọi thủ tục Insert_khoa
            string strr = "EXEC Insert_Khoa @MA_KHOA = '" + txtMaKhoa.Text.Trim() + "',@TEN_KHOA=N'" + txtTenKhoa.Text.Trim() + "'";
            var kn = new Ketnoi(frmDangnhap.stringConn);
            kn.ExcuteQuery(strr);
           // MessageBox.Show("Đã lưu thành công");
            frmNhapDanhSachKhoa_Load(null, null);
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            var f = new frmImportExcell();
            f.Show();
        }

        private void btXoaGiuong_Click(object sender, EventArgs e)
        {
            string strr = "EXEC Delete_KHOA @MA_KHOA ='" +txtMaKhoa.Text.Trim()+ "'";
        }

    }
}